package com.fqdf.framework.android.net.response;

import android.os.Parcel;
import android.os.Parcelable;

public class BasePageInfoBean extends BaseRespBean implements Parcelable {

    /**
     * pageNum : 1
     * pageSize : 20
     * pages : 5
     * total : 100
     */
    private int pageNum;
    private int pageSize;
    private int pages;
    private int total;

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getPages() {
        return pages;
    }

    public void setPages(int pages) {
        this.pages = pages;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.pageNum);
        dest.writeInt(this.pageSize);
        dest.writeInt(this.pages);
        dest.writeInt(this.total);
    }

    public BasePageInfoBean() {
    }

    protected BasePageInfoBean(Parcel in) {
        this.pageNum = in.readInt();
        this.pageSize = in.readInt();
        this.pages = in.readInt();
        this.total = in.readInt();
    }

    public static final Creator<BasePageInfoBean> CREATOR = new Creator<BasePageInfoBean>() {
        @Override
        public BasePageInfoBean createFromParcel(Parcel source) {
            return new BasePageInfoBean(source);
        }

        @Override
        public BasePageInfoBean[] newArray(int size) {
            return new BasePageInfoBean[size];
        }
    };

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof BasePageInfoBean)) return false;

        BasePageInfoBean that = (BasePageInfoBean) o;

        if (getPageNum() != that.getPageNum()) return false;
        if (getPageSize() != that.getPageSize()) return false;
        if (getPages() != that.getPages()) return false;
        return getTotal() == that.getTotal();

    }

    @Override
    public int hashCode() {
        int result = getPageNum();
        result = 31 * result + getPageSize();
        result = 31 * result + getPages();
        result = 31 * result + getTotal();
        return result;
    }

    @Override
    public String toString() {
        return "BasePageInfoBean{" +
                "pageNum=" + pageNum +
                ", pageSize=" + pageSize +
                ", pages=" + pages +
                ", total=" + total +
                '}';
    }
}
